﻿<!--#include file="../Include/Config.asp"-->
<%
dim action,Survey_id,Question_type,Question_content
dim Question_answer,Question_result,Question_img
action=request.QueryString("action")
Survey_id=request.Form("Survey_id")
Question_type=request.Form("Question_type")
Question_content=request.Form("Question_content")
Question_answer=request.Form("Question_answer")
Question_result=request.Form("Question_result")
Question_img=""
for i=0 to ubound(split(Question_result,","))
 if Question_img="" then
 Question_img="null"
 else
 Question_img=Question_img&"&"&"null"
 end if
next
'response.Write(Question_answer)
'response.End()
select case action
case "addnew"
sql="select * from question"
rs.open sql,conn,1,3
rs.addnew
rs("Question_type")=Question_type
rs("Question_content")=Question_content
rs("Question_answer")=Question_answer
rs("Question_result")=Question_result
rs("Question_img")=Question_img
rs.update
Question_id=rs("Question_id")
'response.Write(Question_id)
'response.End()
rs.close
'将添加的题目添加到问卷的题目列表中
sql="select Survey_content from survey where Survey_id="&Survey_id
rs.open sql,conn,1,3
if rs("Survey_content")<>"" then
rs("Survey_content")=rs("Survey_content")&","&Question_id
else
rs("Survey_content")=Question_id
end if
rs.update
rs.close
call ShowAlert("题目添加完成","QuestionAdd.asp?Survey_id="&Survey_id&"")
case "edit"
Survey_id=request.QueryString("Survey_id")
Question_id=request.QueryString("Question_id")
sql="select * from question where Question_id="&Question_id
rs.open sql,conn,1,3
rs("Question_content")=Question_content
rs("Question_answer")=Question_answer
rs.update
rs.close
call ShowAlert("题目修改完成","QuestionAddImg.asp?Survey_id="&Survey_id&"&Question_id="&Question_id&"")
case else response.Write("参数错误")

end select
%>
